<ul class="page-sidebar-menu">
    @foreach($menu as $k => $v)
        <li class="{{ !empty($v['page_name']) && in_array($page_name, $v['page_name']) ? 'active' : '' }}">
            <a href="{{ !empty($v['url']) ? $v['url'] : "javascript:;" }}" {{ !empty($v['target']) ? 'target='.$v['target'].'' : '' }}>
                <i class="fa fa-{{ $v['icon'] ?: 'home' }}"></i>
                <span class="title">{{ $v['text'] ?? '' }}</span>
                @if (!empty($v['sub']))
                    <i class="fa arrow"></i>
                @endif
            </a>
            @if (!empty($v['sub']))
                <ul class="sub-menu">
                    @foreach($v['sub'] as $ssu)
                        <li class="{{ !empty($ssu['page_name']) && in_array($page_name, $ssu['page_name']) ? 'active' : '' }}">
                            <a href="{{ $ssu['url'] ?: '#' }}" {{ !empty($ssu['target']) ? 'target="'.$ssu['target'].'"' : '' }}>{{ $ssu['text'] ?? '' }}</a>
                        </li>
                    @endforeach
                </ul>
            @endif
        </li>
    @endforeach
</ul>
<script>
    // @json($menu)
    // {{ $page_name }}
</script>